import projectConfig from '../project.config.json'

// API基础配置
const API_CONFIG = {
  // 抖音小程序API配置
  DOUYIN: {
    baseUrl: 'https://test2.0551page.cn',
    appid: 'ttcc3bba865335f7eb01'
  },
  // 其他小程序API配置
  DEFAULT: {
    baseUrl: 'https://crm.0551page.cn',
    appid: 'tte57993c47a77fae701'
  }
}

// 根据当前环境获取配置
export const getApiConfig = () => {
  const currentAppid = projectConfig.appid
  const matchedConfig = Object.values(API_CONFIG).find(config =>
    config.appid === currentAppid
  )
  
  return matchedConfig || API_CONFIG.DEFAULT
}

export default API_CONFIG